<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/fs-test-util.js"></script>
</head>
<body>
<script>
description('This test tries calling various filesystem functions with too few arguments.');

function errorCallback(error)
{
    debug("Error occurred:" + error.name);
    finishJSTest();
}

function successCallback(fs)
{
    fileSystem = fs;
    debug("Successfully obtained Persistent FileSystem:" + fileSystem.name);

    shouldThrow("fileSystem.root.removeRecursively()");
    shouldThrow("fileSystem.root.moveTo()");
    shouldThrow("fileSystem.root.copyTo()");
    reader = fileSystem.root.createReader();
    shouldThrow("reader.readEntries()");

    reader.readEntries(function(entries) {
        window.entries = entries;

        fileSystem.root.getFile("/test", { create: true }, function(entry) {
            window.entry = entry;
            shouldThrow("entry.createWriter()");
            shouldThrow("entry.file()");

            entry.createWriter(function(writer) {
                window.writer = writer;

                shouldThrow("writer.write()");
                shouldThrow("writer.seek()");
                shouldThrow("writer.truncate()");

                removeAllInDirectory(fileSystem.root, finishJSTest, finishJSTest);
            });
        });
    });
}

if (window.webkitRequestFileSystem) {
    shouldThrow("webkitResolveLocalFileSystemURL()");
    shouldThrow("webkitRequestFileSystem()");
    shouldThrow("webkitRequestFileSystem(PERSISTENT)");
    shouldThrow("webkitRequestFileSystem(PERSISTENT, 100)");
    webkitRequestFileSystem(window.TEMPORARY, 100, successCallback, errorCallback);
    window.jsTestIsAsync = true;
} else
    debug("This test requires FileSystem API support.");
</script>
</body>
</html>
